﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>系统</title>

<link href="login-box.css" rel="stylesheet" type="text/css" />
</head>

<script type="text/javascript" src="/pfw/jquery/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="/pfw/jquery/jquery.form.js"></script>
<script type="text/javascript" src="/pfw/jquery/jquery.cookie.js"></script>

<script type="text/javascript">
	$(document).ready(function(){
		var account = $.cookie('username');
		var pwd= $.cookie('password');
		if(account && pwd ){
			$('#username').val(account);
			$('#password').val(pwd);
		}else{
			$('#username').focus();
		}
		//表单提交
		$('#form_user').ajaxForm({
		    beforeSubmit: function(a,f,o) {
                           
				if($('#username').val().length == 0){
					$('#password').val(pwd);
					$('#username').focus();
					$('#error_msg').html("请输入登录的帐号");
					$('#error_msg').show();
					return false;
				}
				if($('#password').val().length == 0){
					$('#password').val(pwd);
					$('#password').focus();
					$('#error_msg').html("请输入登录密码");
					$('#error_msg').show();
					return false;
				}
		    },
		    dataType:'json',
		    success: function(responseText) {
		    	 if(responseText.success){ //验证通过
		    		 if(responseText.pwdDeault){
		    			 var username = responseText.username;
		    			 window.location.href = 'update_password.jsp?username='+username;
		    		 }else{
		    			 window.location.href = '/auth/main/main.do'; 
		    		 }
		    		
		    	 }else{
		    		    $('#error_msg').hide();
			    		$('#error_msg').html(responseText.msg);
			    		$('#img_vcode').attr('src','/auth/captchaImageCreate/captcha-image.do');
			    		
			    		$('#error_msg').show();
						$('#password').val(pwd); 
		    	 }
		    }
		});
		//忘记密码
		
	});
	
 function test(){
   $('#form_user').submit();  
 }

</script>
<body>


<div style="padding: 100px 0 0 200px">

<div style="width:600px;border:1px solid #ddd;">
<div id="login-box">

<H2>登录</H2>


<br />
<form id="form_user"  method="POST" action="/auth/systemUser/userlogin.do">
<div id='error_msg'  style='display:none;color:red;margin-bottom:10px;'></div>
<div id="login-box-name" style="margin-top:1px;">用户名:</div><div id="login-box-field" style="margin-top:1px;"><input name="username" id="username" style="height:15px" class="form-login" title="Username" value="" size="30" maxlength="2048" /></div>
<div id="login-box-name">密码:</div><div id="login-box-field"><input name="password" id="password" type="password" class="form-login" title="Password" value="" style="height:15px"  size="30" maxlength="2048" /></div>
<div id="login-box-name">验证码:</div><div id="login-box-field" ><input name="verifyCode" id="verifyCode" class="form-login" title="Username" value="" style="width:50px;height:15px" size="50" maxlength="2048" />    <img id="img_vcode" align="absmiddle" alt="..." src="/auth/captchaImageCreate/captcha-image.do" onclick="this.src='/auth/captchaImageCreate/captcha-image.do';" style="cursor:pointer;border:2px solid #ccc;width: 120px;height: 35px;margin-left:10px"/></div>
<br />

<span class="login-box-options"><input type="checkbox" name="save_login"  value="1"> 记住登录信息 </span>
<br />
<br />
<a href="#" onclick="javascript:$('#form_user').submit();"><img src="images/login-btn.png" width="103" height="42" style="margin-left:90px;" /></a>
</form>




</div>
</div>

</div>













</body>
</html>
